openerp.lodop = function(instance) {
    return;
    instance.web.ActionManager = instance.web.ActionManager.extend({

        init: function (parent, action) {
            this._super(parent);
            //activex的标签放在页面里。
            var obj_string = '<object style="width:0px;height:0px;" id="LODOP_OB" classid="clsid:2105C259-1E0C-4534-8141-A753534CB4CA" width=0 height=0><embed id="LODOP_EM" type="application/x-print-lodop" width=0 height=0 pluginspage="/lodop/static/lib/lodop6/install_lodop32.exe"></embed></object>';
            $(obj_string).appendTo("body");
        },

        ir_actions_report_xml: function(action, options) {
            var self = this;
            instance.web.blockUI();
            return instance.web.pyeval.eval_domains_and_contexts({
                contexts: [action.context],
                domains: []
            }).then(function(res) {
                action = _.clone(action);
                action.context = res.context;
                var os = navigator.platform || "Unknown OS";
                linux = os.indexOf("Linux") > -1;
                mac = os.indexOf("Mac") > -1;

                self.rpc("/web/lodop/report", {
                    action: JSON.stringify(action)
                }).done(function(result) {
                    if(result.error){
                        instance.web.unblockUI();
                        self.dialog_stop();
                        return;
                    }
                    instance.web.unblockUI();
                    self.dialog_stop();
                    if(linux || mac) {
                        //不支持linux, mac, 这点没考虑过。
                        report_window=window.open('','','width=350,height=500');
                        report_window.document.write(result.report);
                        report_window.focus();
                    }
                    else {
                        //do magic.
                        // 等会解释这个由来。
                        format_obj = action.attachment.split(',');

                        LODOP=getLodop(document.getElementById('LODOP'),document.getElementById('LODOP_EM'));
                        LODOP.SET_LICENSES("","xxxxxx","","");  //不设置授权码照样可以打印。
                        LODOP.PRINT_INIT("FG ERP Order");
                        LODOP.SET_PRINT_PAGESIZE(1, 2300, 1390, 'lodop_print_job'); //公司用的各种单据的打印纸都是统一规格，所以写死了。

                        var tables = $.parseHTML(result.report);
                        $.each( tables, function( i, el ) {
                            if(el.nodeName == "TABLE"){
                                LODOP.ADD_PRINT_TABLE(format_obj[0],format_obj[1],format_obj[2], format_obj[3], el.outerHTML);
                                LODOP.NEWPAGE();
                            }
                        });
                        LODOP.PREVIEW();
                    }
                });
            });
        },
    });


};
